import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LXW
 * Date: 2022-05-28
 * Time: 18:39
 */
public class Main {
    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while(true) {
            int choice = user.menu();
            user.doOperation(choice,bookList);
        }
    }


    private static User login() {
        System.out.println("请输入你的姓名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请选择你的身份: 管理员 0   普通用户 1");
        int choice = scanner.nextInt();
        if(choice == 0) {
            return new AdminUser(name);
        }else {
            return new NormalUser(name);
        }
    }
}
